package org.decorator.ex2.eg1;

import java.util.Date;

public class Prize {
	public double calcPrize(String user, Date begin, Date end) {
		double prize = 0.0;

		prize = this.mothPrize(user, begin, end);
		prize += this.sumPrze(user, begin, end);
		return prize;
	}

	private double sumPrze(String user, Date begin, Date end) {
		double prize = 100000.0 * 0.01;
		System.out.println(user + " 累积奖金 " + prize);
		return prize;
	}

	private double mothPrize(String user, Date begin, Date end) {
		double prize = TempDB.mapMothSaleMoney.get(user) * 0.03;

		System.out.println(user + " 当月业务奖金 " + prize);
		return prize;
	}

	private boolean isManager(String user) {
		if ("王五".equals(user)) {
			return true;
		}
		return false;
	}

	private double groupPrize(String user, Date begin, Date end) {
		double group = 0.0;

		for (double d : TempDB.mapMothSaleMoney.values()) {
			group += d;
		}

		double prize = group * 0.01;
		System.out.println(user + " 当月团队业务奖金 " + prize);
		return prize;
	}
}
